//
//  NSArray+WXUtility.m
//  CommonFramework
//
//  Created by leev on 2017/10/24.
//  Copyright © 2017年 XES. All rights reserved.
//

#import "NSArray+WXUtility.h"

@implementation NSArray (WXUtility)

- (id)objectAtIndexSafe:(NSInteger)index
{
    id object = nil;
    if (index < self.count)
    {
        if (index >= 0)
        {
            object = [self objectAtIndex:index];
        }
    }
    return object;
}

+ (BOOL)isEmptyArray:(id)object
{
    if ([[self class] isEmptyTarget:object]) {
        return YES;
    }
    if (![object isKindOfClass:[NSArray class]]) {
        return YES;
    }
    return !([((NSArray *)object) count] > 0);
}


/*判断目标是否为空值*/
+ (BOOL)isEmptyTarget:(id)target
{
    if (target == nil) {
        return YES;
    }
    if (target == NULL) {
        return YES;
    }
    if ([target isKindOfClass:[NSNull class]]) {
        return YES;
    }
    return NO;
}


@end
